package com.sporadic.desk.controller;

import com.sporadic.desk.pojo.Coupon;
import com.sporadic.desk.service.CouponService;
import dto.CouponDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import vo.ResponseData;

import java.util.List;

/**
 * @program: sporadic
 * @description:
 * @author: LHD   QQ:1727865856
 * @create: 2019-12-02 12:02
 **/
@RestController
public class CouponController {
    @Autowired
    private CouponService couponService;


    @GetMapping("/queryByphoneANDmid")
    public ResponseData<List<CouponDTO>> queryByphoneANDmid(String phone, Integer mid) {
        List<CouponDTO> coupons = couponService.queryByPhoneUserCoupon(phone, mid);
        return coupons.isEmpty()?new ResponseData<>(null,"sorry,NotFount!"):new ResponseData<>(coupons);
    }
}
